from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
import time


driver = webdriver.Chrome()
driver.get("https://www.mi.com/shop")
driver.maximize_window()
time.sleep(5)

a_list = driver.find_elements("xpath","//a[@class='title']")
mobile_ele = a_list[0]
tv_ele = a_list[1]
home_app_ele = a_list[2]

time.sleep(2)
# 控制鼠标移动到某个元素的左上角
ActionChains(driver).move_to_element(mobile_ele).perform()
time.sleep(2)
ActionChains(driver).move_by_offset(50,50).perform()
time.sleep(2)
ActionChains(driver).move_to_element_with_offset(home_app_ele,0,50).perform()
time.sleep(2)